<input id="status" name="status" type="hidden" value="{$params.status}"/>
<input id="p" name="p" type="hidden" value="{$p}" />
<table class="table table-bordered">
    <thead>
      <tr>
        <th width="6%">日报ID</th>
        <th width="15%">标题</th>
          <th width="5%">日报类型</th>
        <th width="9%">牛人</th>
          <th width="8%" >是否推荐</th>
          <th>评论数</th>
          <th width="13%">创建时间</th>
        <th width="13%">发布时间</th>
          <th width="8%" >状态</th>
          <th>PV</th>
          <th>昨日UV</th>
        <th width="11%">操作</th>
      </tr>
    </thead>
    <tbody>
      <volist name="article" id="vo" key="k">
        <tr>
          <td>{$vo.article_id}</td>
          <td>{$vo.article_title}</td>
            <td><if condition="$vo['article_attribute'] eq 1">图文<else/>视频</if></td>
          <td>{$vo['nick_name']}</td>
            <td><if condition="$vo.is_top eq 1">是<else/>否</if></td>
            <td><a target="_blank" href="/comment/expertArticle/article_id/{$vo.article_id}">{$vo.comment}</a></td>
            <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
          <td>
              <if condition="$vo['status'] eq 1">
                  {$vo.publish_time|date="Y-m-d H:i:s",###}
                  <elseif condition="$vo['status'] eq 3"/>
                  {$vo.cron_time|date="Y-m-d H:i:s",###}
                  <else/>
                  --
              </if>
          </td>
          <td>
          	<if condition="$vo['status'] eq 0">
          	已下线
			<elseif condition="$vo['status'] eq 1"/>
			已上线
            <elseif condition="$vo['status'] eq 2"/>
            待审核
            <elseif condition="$vo['status'] eq 3"/>
            预发布
			</if>
          </td>
            <td>{$vo.pv}</td>
            <td>{$vo.uv}</td>
          <td>
          	<a target="_blank" href="/Article/expertAdd/id/{$vo.article_id}">编辑</a> | <a href="javascript:;" onclick="openwin('/Article/showExpert/id/{$vo.article_id}');">预览</a>
          	<if condition="$vo.status neq 1"> | <a href="javascript:;" onclick="publish({$vo.article_id});">上线</a></if>
          	<if condition="$vo.status eq 1"> | <a href="javascript:;" onclick="del({$vo.article_id});">下线</a></if>
          </td>
      	</tr>
      </volist>
    </tbody>
  </table>
  <div class="pageFaye"><div class="pager">{$page}</div><div class="clear"></div></div>

<div class="deparHover" style="height: 200px;">
    <h4>分配客服</h4>
    <label>
        <select name="service_id" id="service_id" style="float: right;width: 360px;">
            <option value="0">请选择客服</option>
            <?php foreach($kfs as $kf):?>
            <option value="{$kf.emp_id}">{$kf.real_name}</option>
            <?php endforeach;?>
        </select>
        分配给：
    </label>
    <div class="deparBtn">
        <input type="button" value="确定" class="deparQue" id="fenpeiQueding">
        <input type="button" value="取消" id="fenpeiQuxiao">
    </div>
</div>


<script>

	function publish(id){
		if(confirm('确定要上线该篇文章么?')){
			$.post('/Article/changeExpertStatus',{id:id,status:1}, function(data){
				if(data.code == 200){
					alert('上线成功');
					searchList();
				}else{
					alert('上线失败请重试');
				}
			},'json');
		}
	}
	function del(id){
		if(confirm('确定要下线该篇文章么?')){
			$.post('/Article/changeExpertStatus',{id:id,status:0}, function(data){
				if(data.code == 200){
					alert('下线成功');
                    searchList();
				}else{
					alert('下线失败请重试');
				}
			},'json');
		}
	}



    function openwin(url) {
        var a = document.createElement("a");
        a.setAttribute("href", url);
        a.setAttribute("target", "_blank");
        a.setAttribute("id", "openwin");
        document.body.appendChild(a);
        a.click();
    }

</script>